package com.yingma.common.controller;


import com.yingma.common.util.AjaxResult;
import com.yingma.system.entity.JcZoneStoreroom;
import com.yingma.system.service.JcSysOrganizationService;
import com.yingma.system.service.JcZoneStoreroomService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (JcZoneStoreroom)表控制层
 *
 * @author makejava
 * @since 2020-03-20 11:36:43
 */
@RestController
@RequestMapping("jcZoneStoreroom")
public class JcZoneStoreroomController {
    /**
     * 库存区域对象
     */
    @Resource
    private JcZoneStoreroomService jcZoneStoreroomService;

    /**
     * 组织机构
     */
    @Resource
    private JcSysOrganizationService jcSysOrganizationService;


    @ApiOperation("查询库存区域信息")
    @RequestMapping(value = "/getStoreRoomInfo",method = RequestMethod.POST)
    public AjaxResult selectOne(@ApiParam("组织区域名称") String ZoneName,@ApiParam("库位名称") String name,@ApiParam("当前页数") Integer pageNum,@ApiParam("每页数据量") Integer pageSize) {

        List<JcZoneStoreroom> ZoneStrorelist=jcZoneStoreroomService.getInfo(ZoneName, name, pageNum, pageSize);
        for (int i = 0; i <ZoneStrorelist.size() ; i++) {
            //根据组织区域的ID查询组织机构名称
            ZoneStrorelist.get(i).setJcSysOrganizationList(jcSysOrganizationService.selectById(ZoneStrorelist.get(i).getJcOrganizationId()));
        }
        return AjaxResult.success(ZoneStrorelist);
    }







}
